<?php

namespace App\Http\Controllers\Article;

use App\Http\Controllers\BaseController;
use App\Models\ArticleScore;
use Illuminate\Http\Request;

class ScoreController extends BaseController
{
    public function store(Request $request)
    {
        $params = $this->validate($request,[
            'score' => 'required',
            'article_id' => 'required',
        ]);

        $params['user_id'] = auth('api')->id();
        $comment = ArticleScore::query()->create($params);

        if ($comment->getKey()){
            return $this->success();
        }

        return $this->error();
    }
}
